"use strict";

/**
 * @auther wtfssd
 * Created by wtfssd on 2017/11/15
 */
import * as React from 'react'
import {autoSize, commonStyles} from "../assets/styles/common";
import Avatar from "./Avatar";
import MyText from "./MyText";
import Request from "../utils/Request";
import {get_order_info} from "../interface/index";


const {View, Text} = require('react-native');
const {connect} = require('react-redux');

class ProductItem extends React.Component<get_order_info, any> {
    constructor(props: any, context: any) {
        super(props, context);
    }

    render() {
        return (
            <View style={[commonStyles.flexRow, {padding: 10}]} >
                <Avatar source={{uri:Request.checkImageUrl(this.props.get_order_product.preview)}} size={autoSize(75)} circle={false}/>
                <View style={[commonStyles.flexColumn, {
                    padding: 10,
                    flex: 1,
                    justifyContent: 'space-around'
                }]}>
                    <View>
                        <MyText>{this.props.get_order_product.name}</MyText>
                        <MyText>{this.props.get_order_product.spec}</MyText>
                    </View>
                    <View style={[commonStyles.flexRow, {justifyContent: 'space-between'}]}>
                        <MyText>{`¥ ${Number(this.props.price).toFixed(2)}`}</MyText>
                        <MyText>{`x ${this.props.count}`}</MyText>
                    </View>
                </View>
            </View>
        );
    }
}


export default ProductItem;